{__NOLAYOUT__}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>{$xm.title.val}-{$seo_title}</title>
    <include file="Index:meta" />
    <!-- Swiper -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.min.css" rel="stylesheet">
</head>

<body>
    <div id="page">
        <!-- Header -->
        <include file="Index:header" />
        <!-- Header End -->

        <!-- 项目列表 start -->
        <section class="search container pt-40 mb-40" style="min-height:50vh;">
            <form name="form1" action='index.php?m=Index&a=search' method="post">
                <div class="search-input clearfix">
                    <a data-toggle="dropdown" id='searchtype'><if condition="$searchtypepost neq '' ">{$searchtypepost}<else />素材</if></a>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="###">岗位</a></li>
                        <li><a href="###">项目</a></li>
                        <li><a href="###">课件</a></li>
                        <li><a href="###">素材</a></li>
                    </ul>
                    <button class="search-btn" id='searchbutton'></button>
                    <input type="text" value="{$title}" id='searchtitle' name="title">
                    <input type="hidden" id='searchtypepost' name='searchtypepost' >
                </div>
            </form>
            <div class="search-box pt-60">
                <if condition = "$searchtypepost " >
                    <p class="mb-20">搜索“{$title}”，找到 <span class="text-primary">{$totalnum}</span> 个{$searchtypepost}。</p>
                </if>
                
                <if condition = " $searchtypepost eq '素材' " >
                    <div class="major-list mb-40">
                        <a class="active" data-filter="all">全部</a>
                        <if condition = "$data['img']">
                            <a data-filter="pic">图片素材</a>
                        </if>
                        <if  condition = "$data['mp4']" >
                            <a data-filter="video">视频素材</a>
                        </if>
                        <if  condition = "$data['qita']" >
                            <a data-filter="other">其他素材</a>
                        </if>
                    </div>
                </if>

                <if condition = " $searchtypepost neq '素材'" > 
                    <ul class="mb-40">
                        <volist name='list' id='vo' key='k'>
                            <li class="clearfix">
                                <if condition = " $searchtypepost eq '岗位'" >
                                    <a href="index.php?m=Index&a=major&pid={$vo.zyid}&cid={$vo.id}">
                                <elseif condition = " $searchtypepost eq '项目'" />
                                    <a href="index.php?m=Index&a=details&pid={$vo.zhuanyeid}&cid={$vo.gwid}&oid={$vo.id}">
                                <elseif condition = " $searchtypepost eq '课件'" /> 
                                    <if condition = " $vo['abc'] eq 'true' " >
                                        <a href="index.php?m=Index&a=detailsplay&{$vo.type}={$vo.id}&file={$vo.filepath}&title={$vo.title|urlencode=###|urlencode=###}">
                                    <else />
                                        <a href="javascript:(new $.zui.ModalTrigger({icon:'info-sign', title:'系统提示',custom:'尊敬的用户：你没有权限观看本内容，请登录相应的权限账号。' })).show();" title="{$vo.title}">  
                                    </if>
                                </if>
                                    <if condition = " $searchtypepost eq '课件'" >
                                        <div class="col-sm-9 col-xs-7 text-ellipsis title">
                                    <else />
                                        <div class="col-sm-3 col-xs-7 text-ellipsis title">
                                    </if>
                                        {$vo.title}</div>
                                    <if condition = " $searchtypepost eq '岗位' or $searchtypepost eq '项目' " >
                                        <div class="col-sm-4 text-ellipsis hide-sm">{$vo.zhuanyename}</div>
                                    </if>
                                    <if condition = " $searchtypepost eq '岗位' " >
                                        <div class="col-sm-2 text-ellipsis hide-sm"> 总项目数：{$vo.totalxm}</div>
                                    <elseif condition = " $searchtypepost eq '项目' " /> 
                                        <div class="col-sm-2 text-ellipsis hide-sm"> 总课件数：{$vo.totalxm}</div>
                                    </if>
                                    <div class="col-sm-3 text-ellipsis col-xs-5">建课人：{$vo.username}</div>
                                </a>
                            </li>
                        </volist>
                    </ul>
                    
                <else />
            
                    <if condition = "$data['img']">
                        <div class="card-group clearfix mb-20 imgbox" id="pic">
                            <h2 class="con-title mb-20">图片素材</h2>
                            <div class="row">
                                <!-- 项目列表 块  start -->
                                <volist name="data['img']" id='vo' key='k'>
                                    <div class="card-box">
                                        <div class="card-box-content">
                                            <div class="card-img">
                                                <img data-image="http://hgedu.fjhgkj.com{$vo.filepath}" 
                                                <if condition = " $vo['isok'] eq 'true' " >
                                                    data-fileonoff="true" 
                                                <else />
                                                    data-fileonoff="false" 
                                                </if>
                                                data-title="{$vo.filename}" data-content="建课人：{$vo.username}" src="__PUBLIC__/dist/image/img.jpg" data-src="http://hgedu.fjhgkj.com{$vo.filepath}"  title="{$vo.filename}">
                                            </div>
                                        </div>
                                    </div>
                                </volist>
                                <!-- 项目列表 块  end -->
                            </div>
                        </div>

                        <!-- 图片显示 -->
                        <div class="modal fade" id="lightimg">
                            <div class="modal-dialog">
                                <div class="modal-content clearfix">
                                    <div class="col-md-9 image">
                                        <button class="controller prev show">
                                            <i class="icon icon-chevron-left"></i>
                                        </button>
                                        <button class="controller next show">
                                            <i class="icon icon-chevron-right"></i>
                                        </button>
                                        <img id="lightimgSrc" src="">
                                    </div>
                                    <div class="col-md-3 content">
                                        <h4 id="lightimgTitle" class="mb-20">图片名称</h4>
                                        <p id="lightimgContent" class="mb-60"></p>
                                        <div class="text-right">
                                            <a download class="btn btn-block btn-primary" id="lightimgDown">下载</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </if>
                    <if  condition = "$data['mp4']" >
                        <div class="card-group clearfix" id="video">
                            <h2 class="con-title mb-20">视频素材</h2>
                            <div class="list-down row">
                                <ul>
                                    <volist name="data['mp4']" id='vo' key='k'>
                                        <li>
                                            <div class="row">
                                                <if condition = " $vo['isok'] eq 'true' " >
                                                    <a class="icon icon-down" download="{$vo.filename} href="index.php?m=Index&a=video&file=http://hgedu.fjhgkj.com{$vo.filepath}" title="点击下载"></a>
                                                    <a href="index.php?m=Index&a=video&file=http://hgedu.fjhgkj.com{$vo.filepath}" target="_blank" title="点击观看">
                                                <else/>
                                                    <a class="icon icon-down disabled" title="需下载申请"></a>
                                                    <a href="javascript:(new $.zui.ModalTrigger({icon:'info-sign', title:'系统提示',custom:'尊敬的用户：你没有权限观看本内容，请登录相应的权限账号。' })).show();" title="{$vo.filename}"> 
                                                </if>
                                                    <p class="title text-ellipsis">{$vo.filename}</p>
                                                </a>
                                            </div>
                                        </li>
                                    </volist>
                                </ul>
                            </div>
                        </div>
                    </if>
                    
                    <if  condition = "$data['qita']" >
                        <div class="card-group clearfix" id="other">
                            <h2 class="con-title mb-20">其他素材</h2>
                            <div class="list-down row">
                                <ul>
                                    <volist name="data['qita']" id='vo' key='k'>
                                        <li>
                                            <div class="row">
                                                <if condition = " $vo['isok'] eq 'true' " >
                                                    <a class="icon icon-down" download="{$vo.filename} href="http://hgedu.fjhgkj.com{$vo.filepath}" title="{$vo.filename}"></a>
                                                <else/>
                                                    <a class="icon icon-down disabled" title="需下载申请"></a>
                                                </if>
                                                <p class="title text-ellipsis" title="{$vo.filename}">{$vo.filename}</p>
                                            </div>
                                        </li>
                                    </volist>
                                </ul>
                            </div>
                        </div>
                    </if>

                </if>
            </div>
        </section>
        
        <include file="Index:footer" />
    </div>
<script>
$(function(){
    $(".dropdown-menu").on("click","a",function(){
        console.log($(this).html())
        $(".search-input > a").html($(this).html());
    })

    $("#searchbutton").on("click",function(){
         var sno = $("#searchtitle").val() ;
        if(sno.indexOf(" ") >= 0 || sno == null){
            alert('请输入搜索内容') ;
            return false ;
        }
        $("#searchtypepost").val($("#searchtype").html()) ;
        form1.submit() ;
    })

    $("[data-filter]").on("click",function(){
        $("[data-filter]").removeClass("active");
        $(this).addClass("active");

        var id = $(this).attr("data-filter");
        if( id == "all" ){
            $(".card-group").removeClass("none");
        }else{
            $(".card-group").addClass("none");
            $("#" + id).removeClass("none");
        }
    })


    imgbox = $(".imgbox");
    imgbox.on("click", "[data-image]", function () {
        var that = $(this);
        index = that.parents(".card-box").index();

        lightImg(index)
        $('#lightimg').modal({
            position: 'fit',
            show: true
        });
    })
    function lightImg(num) {
        if (num == 0) {
            if (imgbox.find("[data-image]").length - 1 == 0) {
                $("#lightimg .controller").removeClass("show");
            } else {
                $("#lightimg .controller.prev").removeClass("show");
                $("#lightimg .controller.next").addClass("show");
            }
        } else if (num == imgbox.find("[data-image]").length - 1) {
            $("#lightimg .controller.prev").addClass("show");
            $("#lightimg .controller.next").removeClass("show");
        } else {
            $("#lightimg .controller.prev").addClass("show");
            $("#lightimg .controller.next").addClass("show");
        }

        var o = imgbox.find(".card-box").eq(num).find("img");
        $("#lightimgSrc").attr("src", o.data("image"));
        $("#lightimgTitle").html(o.data("title"));
        // $("#lightimgTime").html(o.data("time"));
        $("#lightimgContent").html(o.data("content"));
        //$("#lightimgDown").attr("href", o.attr("src"));
        if(o.data("fileonoff")){
            $("#lightimgDown").attr("href", o.data("image"));
            $("#lightimgDown").removeAttr("disabled").removeClass("btn-disabled").removeClass("disabled").addClass("btn-primary");
        }else{
            $("#lightimgDown").attr("href", "");
            $("#lightimgDown").attr("disabled","").addClass("btn-disabled").addClass("disabled").removeClass("btn-primary");
        }
    }
    $("#lightimg").on("click", ".prev", function () {
        index--;
        lightImg(index);
    })
    $("#lightimg").on("click", ".next", function () {
        index++;
        lightImg(index);
    })
})
</script>
</body>
</html>